package cn.autumnorange.app.money.provider.rest;

import cn.autumnorange.app.common.dto.ResultDto;
import cn.autumnorange.app.money.api.MoneyService2;
import cn.autumnorange.app.money.api.dto.MoneyDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class SysMoneyRest implements MoneyService2 {
  @Autowired private MoneyService2 moneyService2;

  @Value("${server.port}")
  private int port;
  //  @RPCIdempotentLockTarget()

  @Override
  public ResponseEntity<ResultDto<MoneyDto>> add2(
      @PathVariable(value = "version") Long version, @PathVariable(value = "money") Long money) {
    return moneyService2.add2(version, money);
  }

  @Override
  public ResponseEntity<ResultDto<Long>> getVersion(Long id) {
    return moneyService2.getVersion(id);
  }
}
